
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>1.2 Hadoop伪分布式安装 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="1.3.html" />
    
    
    <link rel="prev" href="1.1.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" >
            
                <span>
            
                    
                    第一章 Hadoop环境搭建
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="1.1.html">
            
                <a href="1.1.html">
            
                    
                    1.1 安装JDK
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.2.2" data-path="1.2.html">
            
                <a href="1.2.html">
            
                    
                    1.2 Hadoop伪分布式安装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="1.3.html">
            
                <a href="1.3.html">
            
                    
                    1.3 完全分布式环境搭建
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" >
            
                <span>
            
                    
                    第二章 Hadoop高可用
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../chapter2/HadoopHA原理.html">
            
                <a href="../chapter2/HadoopHA原理.html">
            
                    
                    2.1 HadoopHA原理与机制
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../chapter2/HadoopHA搭建规划.html">
            
                <a href="../chapter2/HadoopHA搭建规划.html">
            
                    
                    2.2 HadoopHA搭建规划 
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../chapter2/Zookeeper介绍.html">
            
                <a href="../chapter2/Zookeeper介绍.html">
            
                    
                    2.3 Zookeeper介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../chapter2/Zookeeper搭建.html">
            
                <a href="../chapter2/Zookeeper搭建.html">
            
                    
                    2.4 Zookeeper配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="../chapter2/HadoopHA配置.html">
            
                <a href="../chapter2/HadoopHA配置.html">
            
                    
                    2.5 HadoopHA配置
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" >
            
                <span>
            
                    
                    第三章 动态增删节点与常见配置
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../chapter3/3.1集群节点动态增删.html">
            
                <a href="../chapter3/3.1集群节点动态增删.html">
            
                    
                    3.1 集群节点的动态增删
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../chapter3/3.2常见错误与常用配置.html">
            
                <a href="../chapter3/3.2常见错误与常用配置.html">
            
                    
                    3.2 常见错误与常用配置
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >1.2 Hadoop伪分布式安装</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h3 id="&#x4E0B;&#x8F7D;hadoop">&#x4E0B;&#x8F7D;Hadoop</h3>
<p>&#x5B98;&#x7F51;&#x4E0B;&#x8F7D;&#xFF1A;<a href="http://hadoop.apache.org/" target="_blank">http://hadoop.apache.org/</a></p>
<p><img src="https://upload-images.jianshu.io/upload_images/7013389-9399773320da256a.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="image.png"></p>
<p><img src="https://upload-images.jianshu.io/upload_images/7013389-ee061c473ebf0b67.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="image.png"></p>
<p><img src="https://upload-images.jianshu.io/upload_images/7013389-6965be449d081df3.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="image.png"></p>
<p>&#x8F93;&#x5165;<code>wget</code>&#x4E0B;&#x8F7D;Hadoop&#x3002;</p>
<p>&#x5982;&#x679C;&#x6211;&#x4EEC;&#x662F;&#x751F;&#x4EA7;&#x73AF;&#x5883;&#x5C31;&#x9700;&#x8981;&#x9A8C;&#x8BC1;&#x6587;&#x4EF6;&#x7684;&#x5B8C;&#x6574;&#x6027;&#xFF0C;&#x5728;&#x8FD9;&#x91CC;&#x6211;&#x4EEC;&#x5C31;&#x5077;&#x4E2A;&#x61D2;&#x4E86;&#x3002;</p>
<p>&#x63A5;&#x4E0B;&#x6765;&#x89E3;&#x538B;<code>Hadoop</code>&#x7684;&#x538B;&#x7F29;&#x5305;&#xFF0C;&#x7136;&#x540E;&#x5C06;&#x89E3;&#x538B;&#x597D;&#x7684;&#x6587;&#x4EF6;&#x79FB;&#x52A8;&#x5230;<code>/app</code>&#x76EE;&#x5F55;&#x4E0B;&#x3002;</p>
<p><img src="https://upload-images.jianshu.io/upload_images/7013389-0ae14a40db2ffff2.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="image.png"></p>
<p>&#x6211;&#x4EEC;&#x6765;&#x5207;&#x6362;&#x5230;app&#x76EE;&#x5F55;&#x4E0B;&#x4FEE;&#x6539;&#x4E00;&#x4E0B;hadoop&#x6587;&#x4EF6;&#x5939;&#x7684;&#x540D;&#x5B57;</p>
<p><img src="https://upload-images.jianshu.io/upload_images/7013389-f48f61b763ad50ab.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="image.png"></p>
<h4 id="&#x914D;&#x7F6E;hadoop&#x73AF;&#x5883;">&#x914D;&#x7F6E;Hadoop&#x73AF;&#x5883;</h4>
<p>&#x63A5;&#x4E0B;&#x6765;&#x6211;&#x4EEC;&#x5F00;&#x59CB;&#x914D;&#x7F6E;Hadoop&#x5F00;&#x53D1;&#x73AF;&#x5883;&#x3002;
&#x54B1;&#x4EEC;&#x6765;&#x642D;&#x5EFA;&#x4E00;&#x4E2A;&#x5355;&#x8282;&#x70B9;&#x7684;&#x96C6;&#x7FA4;&#xFF0C;&#x914D;&#x7F6E;&#x4E00;&#x4E2A;&#x4F2A;&#x5206;&#x5E03;&#x5F0F;&#x3002;</p>
<h5 id="&#x8BBE;&#x7F6E;ssh&#x514D;&#x5BC6;&#x767B;&#x5F55;">&#x8BBE;&#x7F6E;SSH&#x514D;&#x5BC6;&#x767B;&#x5F55;</h5>
<p>&#x5728;&#x4E4B;&#x540E;&#x64CD;&#x4F5C;&#x96C6;&#x7FA4;&#x7684;&#x65F6;&#x5019;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x7ECF;&#x5E38;&#x767B;&#x5F55;&#x4E3B;&#x673A;&#x548C;&#x4ECE;&#x673A;&#xFF0C;&#x6240;&#x4EE5;&#x8BBE;&#x7F6E;SSH&#x514D;&#x5BC6;&#x767B;&#x5F55;&#x65F6;&#x6709;&#x5FC5;&#x8981;&#x7684;&#x3002;</p>
<p>&#x8F93;&#x5165;&#x5982;&#x4E0B;&#x4EE3;&#x7801;&#xFF1A;</p>
<pre><code class="lang-shell"> ssh-keygen -t rsa -P &apos;&apos;
</code></pre>
<p>&#x751F;&#x6210;&#x65E0;&#x5BC6;&#x7801;&#x5BC6;&#x94A5;&#x5BF9;&#xFF0C;&#x8BE2;&#x95EE;&#x4FDD;&#x5B58;&#x8DEF;&#x5F84;&#x76F4;&#x63A5;&#x8F93;&#x5165;&#x56DE;&#x8F66;&#xFF0C;&#x751F;&#x6210;&#x5BC6;&#x94A5;&#x5BF9;&#xFF1A;<code>id_rsa&#x548C;id_rsa.pub</code>&#xFF0C;&#x9ED8;&#x8BA4;&#x5B58;&#x50A8;&#x5728;<code>/home/hadoop/.ssh</code>&#x76EE;&#x5F55;&#x4E0B;&#x3002; 
&#x63A5;&#x4E0B;&#x6765;&#xFF1A;&#x628A;<code>id_rsa.pub</code>&#x8FFD;&#x52A0;&#x5230;&#x6388;&#x6743;&#x7684;<code>key</code>&#x91CC;&#x9762;&#x53BB;&#x3002;</p>
<pre><code class="lang-shell">cat ~/.ssh/id_rsa.pub &gt;&gt; ~/.ssh/authorized_keys
</code></pre>
<p>&#x7136;&#x540E;&#x4FEE;&#x6539;&#x6743;&#x9650;&#xFF1A;</p>
<pre><code class="lang-shell">chmod 600 ~/.ssh/authorized_keys
</code></pre>
<p>&#x63A5;&#x7740;&#x9700;&#x8981;&#x542F;&#x7528;RSA&#x8BA4;&#x8BC1;&#xFF0C;&#x542F;&#x52A8;&#x516C;&#x94A5;&#x79C1;&#x94A5;&#x914D;&#x5BF9;&#x8BA4;&#x8BC1;&#x65B9;&#x5F0F;<br><code>vim /etc/ssh/sshd_config</code>  &#x5982;&#x679C;&#x63D0;&#x793A;&#x6743;&#x9650;&#x4E0D;&#x8DB3;&#x5728;&#x547D;&#x4EE4;&#x524D;&#x52A0;&#x4E0A;<code>sudo</code>
&#x4FEE;&#x6539;ssh&#x914D;&#x7F6E;&#xFF1A;</p>
<pre><code class="lang-shell">RSAAuthentication yes # &#x542F;&#x7528; RSA &#x8BA4;&#x8BC1;
PubkeyAuthentication yes # &#x542F;&#x7528;&#x516C;&#x94A5;&#x79C1;&#x94A5;&#x914D;&#x5BF9;&#x8BA4;&#x8BC1;&#x65B9;&#x5F0F;
AuthorizedKeysFile %h/.ssh/authorized_keys # &#x516C;&#x94A5;&#x6587;&#x4EF6;&#x8DEF;&#x5F84;
</code></pre>
<p><img src="https://upload-images.jianshu.io/upload_images/7013389-0b2e78cd704a1574.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="image.png"></p>
<p>&#x91CD;&#x542F;SSH</p>
<p><code>service ssh restart</code></p>
<p>&#x597D;&#x4E86;&#x51C6;&#x5907;&#x5DE5;&#x4F5C;&#x5DF2;&#x7ECF;&#x505A;&#x5B8C;&#x4E86;&#xFF0C;&#x6211;&#x4EEC;&#x8981;&#x5F00;&#x59CB;&#x4FEE;&#x6539;Hadoop&#x7684;&#x914D;&#x7F6E;&#x6587;&#x4EF6;&#x4E86;&#xFF0C;&#x603B;&#x5171;&#x9700;&#x8981;&#x4FEE;&#x6539;6&#x4E2A;&#x6587;&#x4EF6;&#x3002;&#x5206;&#x522B;&#x662F;&#xFF1A;</p>
<ul>
<li>hadoop-env.sh </li>
<li>yarn-env.sh </li>
<li>core-site.xml </li>
<li>hdfs-site.xml </li>
<li>mapred-site.xml </li>
<li>yarn-site.xml</li>
</ul>
<p>&#x6211;&#x4EEC;&#x4E00;&#x4E2A;&#x4E00;&#x4E2A;&#x63A5;&#x7740;&#x6765;&#x914D;&#x7F6E;&#x5427;&#xFF01;</p>
<h5 id="hadoop-envsh-&#x914D;&#x7F6E;">hadoop-env.sh &#x914D;&#x7F6E;</h5>
<p>&#x4E24;&#x4E2A;<code>env.sh</code>&#x6587;&#x4EF6;&#x4E3B;&#x8981;&#x662F;&#x914D;&#x7F6E;JDK&#x7684;&#x4F4D;&#x7F6E;</p>
<p>&#x63D0;&#x793A;&#xFF1A;&#x5982;&#x679C;&#x5FD8;&#x8BB0;&#x4E86;JDK&#x7684;&#x4F4D;&#x7F6E;&#x4E86;&#xFF0C;&#x8F93;&#x5165; <code>echo $JAVA_HOME</code>&#x5C31;&#x53EF;&#x4EE5;&#x770B;&#x5230;&#x54E6;&#x3002;</p>
<p>&#x9996;&#x5148;&#x6211;&#x4EEC;&#x5207;&#x6362;&#x5230;<code>hadoop</code>&#x76EE;&#x5F55;&#x4E0B;
<img src="https://upload-images.jianshu.io/upload_images/7013389-af1a9e38f26b2c3c.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="image.png">
&#x7F16;&#x8F91;  <code>hadoop-env.sh</code>&#x5728;&#x6587;&#x4EF6;&#x4E2D;&#x63D2;&#x5165;&#x5982;&#x4E0B;&#x4EE3;&#x7801;&#xFF1A; </p>
<pre><code class="lang-shell"># The java implementation to use.  
#export JAVA_HOME=${JAVA_HOME}  
export JAVA_HOME=/app/jdk1.8.0_171
</code></pre>
<h5 id="yarn-envsh-&#x914D;&#x7F6E;">yarn-env.sh &#x914D;&#x7F6E;</h5>
<p>&#x7F16;&#x8F91;<code>yarn-env.sh</code> &#x63D2;&#x5165;&#x5982;&#x4E0B;&#x4EE3;&#x7801;&#xFF1A;</p>
<pre><code class="lang-shell">export JAVA_HOME=/app/jdk1.8.0_171
</code></pre>
<p><img src="https://upload-images.jianshu.io/upload_images/7013389-4dc5c119fc1a1ccb.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="image.png"></p>
<h5 id="core-sitexml&#x914D;&#x7F6E;">core-site.xml&#x914D;&#x7F6E;</h5>
<p>&#x8FD9;&#x4E2A;&#x662F;&#x6838;&#x5FC3;&#x914D;&#x7F6E;&#x6587;&#x4EF6;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x5728;&#x8BE5;&#x6587;&#x4EF6;&#x4E2D;&#x52A0;&#x5165; HDFS&#x7684;URI&#x548C;NameNode&#x7684;&#x4E34;&#x65F6;&#x6587;&#x4EF6;&#x5939;&#x4F4D;&#x7F6E;&#xFF0C;&#x8FD9;&#x4E2A;&#x4E34;&#x65F6;&#x6587;&#x4EF6;&#x5939;&#x5728;&#x4E0B;&#x6587;&#x4E2D;&#x4F1A;&#x521B;&#x5EFA;&#x3002;
&#x5728;&#x6587;&#x4EF6;&#x672B;&#x5C3E;&#x7684;<code>configuration</code>&#x6807;&#x7B7E;&#x4E2D;&#x6DFB;&#x52A0;&#x4EE3;&#x7801;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre><code class="lang-shell">&lt;configuration&gt;  
 &lt;property&gt;  
    &lt;name&gt;fs.default.name&lt;/name&gt;  
    &lt;value&gt;hdfs://localhost:9000&lt;/value&gt;  
    &lt;description&gt;HDFS&#x7684;URI&#xFF0C;&#x6587;&#x4EF6;&#x7CFB;&#x7EDF;://namenode&#x6807;&#x8BC6;:&#x7AEF;&#x53E3;&#x53F7;&lt;/description&gt;  
&lt;/property&gt;  

&lt;property&gt;  
    &lt;name&gt;hadoop.tmp.dir&lt;/name&gt;  
    &lt;value&gt;/usr/hadoop/tmp&lt;/value&gt;  
    &lt;description&gt;namenode&#x4E0A;&#x672C;&#x5730;&#x7684;hadoop&#x4E34;&#x65F6;&#x6587;&#x4EF6;&#x5939;&lt;/description&gt;  
&lt;/property&gt;  
&lt;/configuration&gt;
</code></pre>
<h5 id="hdfs-sitexml&#x6587;&#x4EF6;&#x914D;&#x7F6E;">hdfs-site.xml&#x6587;&#x4EF6;&#x914D;&#x7F6E;</h5>
<p>replication&#x6307;&#x7684;&#x662F;&#x526F;&#x672C;&#x6570;&#x91CF;&#xFF0C;&#x6211;&#x4EEC;&#x73B0;&#x5728;&#x662F;&#x5355;&#x8282;&#x70B9;&#xFF0C;&#x6240;&#x4EE5;&#x662F;1.</p>
<pre><code class="lang-shell">&lt;configuration&gt;  
&lt;property&gt;  
    &lt;name&gt;dfs.name.dir&lt;/name&gt;  
    &lt;value&gt;/usr/hadoop/hdfs/name&lt;/value&gt;  
    &lt;description&gt;namenode&#x4E0A;&#x5B58;&#x50A8;hdfs&#x540D;&#x5B57;&#x7A7A;&#x95F4;&#x5143;&#x6570;&#x636E; &lt;/description&gt;   
&lt;/property&gt;  

&lt;property&gt;  
    &lt;name&gt;dfs.data.dir&lt;/name&gt;  
    &lt;value&gt;/usr/hadoop/hdfs/data&lt;/value&gt;  
    &lt;description&gt;datanode&#x4E0A;&#x6570;&#x636E;&#x5757;&#x7684;&#x7269;&#x7406;&#x5B58;&#x50A8;&#x4F4D;&#x7F6E;&lt;/description&gt;  
&lt;/property&gt;  

&lt;property&gt;  
    &lt;name&gt;dfs.replication&lt;/name&gt;  
    &lt;value&gt;1&lt;/value&gt;  
&lt;/property&gt;  
&lt;/configuration&gt;
</code></pre>
<h5 id="mapred-sitexml&#x6587;&#x4EF6;&#x914D;&#x7F6E;">mapred-site.xml&#x6587;&#x4EF6;&#x914D;&#x7F6E;</h5>
<pre><code class="lang-shell">&lt;configuration&gt;
    &lt;property&gt;
        &lt;name&gt;mapreduce.framework.name&lt;/name&gt;
        &lt;value&gt;yarn&lt;/value&gt;
    &lt;/property&gt;
&lt;/configuration&gt;
</code></pre>
<h5 id="yarn-sitexml&#x914D;&#x7F6E;">yarn-site.xml&#x914D;&#x7F6E;</h5>
<pre><code class="lang-shell">&lt;configuration&gt;  
&lt;property&gt;  
        &lt;name&gt;yarn.nodemanager.aux-services&lt;/name&gt;  
        &lt;value&gt;mapreduce_shuffle&lt;/value&gt;  
&lt;/property&gt;  
&lt;property&gt;  
        &lt;name&gt;yarn.resourcemanager.webapp.address&lt;/name&gt;  
        &lt;value&gt;192.168.2.10:8099&lt;/value&gt;  
        &lt;description&gt;&#x8FD9;&#x4E2A;&#x5730;&#x5740;&#x662F;mr&#x7BA1;&#x7406;&#x754C;&#x9762;&#x7684;&lt;/description&gt;  
&lt;/property&gt;  
&lt;/configuration&gt;
</code></pre>
<h5 id="&#x521B;&#x5EFA;&#x6587;&#x4EF6;&#x5939;">&#x521B;&#x5EFA;&#x6587;&#x4EF6;&#x5939;</h5>
<p>&#x6211;&#x4EEC;&#x5728;&#x914D;&#x7F6E;&#x6587;&#x4EF6;&#x4E2D;&#x914D;&#x7F6E;&#x4E86;&#x4E00;&#x4E9B;&#x6587;&#x4EF6;&#x5939;&#x8DEF;&#x5F84;&#xFF0C;&#x73B0;&#x5728;&#x6211;&#x4EEC;&#x6765;&#x521B;&#x5EFA;&#x4ED6;&#x4EEC;&#xFF0C;&#x5728;<code>/usr/hadoop/</code>&#x76EE;&#x5F55;&#x4E0B;&#x4F7F;&#x7528;<strong>hadoop</strong>&#x7528;&#x6237;&#x64CD;&#x4F5C;&#xFF0C;&#x5EFA;&#x7ACB;<code>tmp</code>&#x3001;<code>hdfs/name</code>&#x3001;<code>hdfs/data</code>&#x76EE;&#x5F55;&#xFF0C;&#x6267;&#x884C;&#x5982;&#x4E0B;&#x547D;&#x4EE4; &#xFF1A;</p>
<pre><code class="lang-shell">mkdir /usr/hadoop/tmp 
mkdir /usr/hadoop/hdfs 
mkdir /usr/hadoop/hdfs/data 
mkdir /usr/hadoop/hdfs/name
</code></pre>
<h5 id="&#x5C06;hadoop&#x6DFB;&#x52A0;&#x5230;&#x73AF;&#x5883;&#x53D8;&#x91CF;&#x4E2D;">&#x5C06;Hadoop&#x6DFB;&#x52A0;&#x5230;&#x73AF;&#x5883;&#x53D8;&#x91CF;&#x4E2D;</h5>
<pre><code class="lang-shell">vim /etc/profile
</code></pre>
<p>&#x5728;&#x6587;&#x4EF6;&#x672B;&#x5C3E;&#x63D2;&#x5165;&#x5982;&#x4E0B;&#x4EE3;&#x7801;&#xFF1A;</p>
<p><img src="https://upload-images.jianshu.io/upload_images/7013389-2a06077a40e8e507.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="image.png"></p>
<p>&#x6700;&#x540E;&#x4F7F;&#x4FEE;&#x6539;&#x751F;&#x6548;&#xFF1A;<code>source /etc/profile</code></p>
<h4 id="&#x9A8C;&#x8BC1;">&#x9A8C;&#x8BC1;</h4>
<p>&#x73B0;&#x5728;&#x914D;&#x7F6E;&#x5DE5;&#x4F5C;&#x5DF2;&#x7ECF;&#x57FA;&#x672C;&#x641E;&#x5B9A;&#xFF0C;&#x63A5;&#x4E0B;&#x6765;&#x53EA;&#x9700;&#x8981;&#x5B8C;&#x6210;&#xFF1A;1.&#x683C;&#x5F0F;&#x5316;HDFS&#x6587;&#x4EF6;&#x3001;2.&#x542F;&#x52A8;hadoop&#x3001;3.&#x9A8C;&#x8BC1;Hadoop &#x5373;&#x53EF;</p>
<h5 id="&#x683C;&#x5F0F;&#x5316;">&#x683C;&#x5F0F;&#x5316;</h5>
<p>&#x5728;&#x4F7F;&#x7528;Hadoop&#x4E4B;&#x524D;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x683C;&#x5F0F;&#x5316;&#x4E00;&#x4E9B;hadoop&#x7684;&#x57FA;&#x672C;&#x4FE1;&#x606F;&#x3002;
&#x4F7F;&#x7528;&#x5982;&#x4E0B;&#x547D;&#x4EE4;&#xFF1A;</p>
<pre><code class="lang-shell">hadoop namenode -format
</code></pre>
<p>&#x51FA;&#x73B0;&#x5982;&#x4E0B;&#x754C;&#x9762;&#x4EE3;&#x8868;&#x6210;&#x529F;&#xFF1A;</p>
<p><img src="https://upload-images.jianshu.io/upload_images/7013389-959f6b44020ffa98.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="image.png"></p>
<h5 id="&#x542F;&#x52A8;hadoop">&#x542F;&#x52A8;Hadoop</h5>
<p>&#x63A5;&#x4E0B;&#x6765;&#x6211;&#x4EEC;&#x542F;&#x52A8;Hadoop&#xFF1A;</p>
<pre><code>start-dfs.sh
</code></pre><p>&#x8F93;&#x5165;&#x547D;&#x4EE4;&#x5E94;&#x8BE5;&#x4F1A;&#x51FA;&#x73B0;&#x5982;&#x4E0B;&#x56FE;&#x754C;&#x9762;&#xFF1A;</p>
<p><img src="https://upload-images.jianshu.io/upload_images/7013389-d08fd24bccd7a834.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="image.png"></p>
<p>&#x8FD9;&#x4E2A;&#x662F;&#x8868;&#x793A;&#x542F;&#x52A8;&#x6CA1;&#x6210;&#x529F;&#xFF0C;&#x662F;&#x56E0;&#x4E3A;<code>root</code>&#x7528;&#x6237;&#x73B0;&#x5728;&#x8FD8;&#x4E0D;&#x80FD;&#x542F;&#x52A8;<code>hadoop</code>&#xFF0C;&#x6211;&#x4EEC;&#x6765;&#x8BBE;&#x7F6E;&#x4E00;&#x4E0B;&#x5C31;&#x53EF;&#x4EE5;&#x4E86;&#x3002;</p>
<p>&#x5728;<code>/hadoop3.1/sbin</code>&#x8DEF;&#x5F84;&#x4E0B;&#xFF1A; <code>cd /app/hadoop3.1/sbin</code>&#x3002;
&#x5C06;<code>start-dfs.sh</code>&#xFF0C;<code>stop-dfs.sh</code>&#x4E24;&#x4E2A;&#x6587;&#x4EF6;&#x9876;&#x90E8;&#x6DFB;&#x52A0;&#x4EE5;&#x4E0B;&#x53C2;&#x6570;</p>
<pre><code>#!/usr/bin/env bash
HDFS_DATANODE_USER=root
HADOOP_SECURE_DN_USER=hdfs
HDFS_NAMENODE_USER=root
HDFS_SECONDARYNAMENODE_USER=root
</code></pre><p>&#x8FD8;&#x6709;&#xFF0C;<code>start-yarn.sh</code>&#xFF0C;<code>stop-yarn.sh</code>&#x9876;&#x90E8;&#x4E5F;&#x9700;&#x6DFB;&#x52A0;&#x4EE5;&#x4E0B;&#xFF1A;</p>
<pre><code>#!/usr/bin/env bash
YARN_RESOURCEMANAGER_USER=root
HADOOP_SECURE_DN_USER=yarn
YARN_NODEMANAGER_USER=root
</code></pre><p>&#x518D;&#x6B21;&#x542F;&#x52A8;<code>start-dfs.sh</code>&#xFF0C;&#x6700;&#x540E;&#x8F93;&#x5165;&#x547D;&#x4EE4; <code>jps</code> &#x9A8C;&#x8BC1;,&#x51FA;&#x73B0;&#x5982;&#x4E0B;&#x754C;&#x9762;&#x4EE3;&#x8868;&#x542F;&#x52A8;&#x6210;&#x529F;&#xFF1A;</p>
<p><img src="https://upload-images.jianshu.io/upload_images/7013389-f8d7c11130d2a81f.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="image.png"></p>
<p>&#x4E4B;&#x540E;&#x5982;&#x679C;&#x4F60;&#x662F;&#x56FE;&#x5F62;&#x5316;&#x754C;&#x9762;&#xFF0C;&#x53EF;&#x4EE5;&#x5728;&#x4F60;&#x865A;&#x62DF;&#x673A;&#x7684;&#x56FE;&#x5F62;&#x5316;&#x754C;&#x9762;&#x4E2D;&#x6253;&#x5F00;&#x706B;&#x72D0;&#x6D4F;&#x89C8;&#x5668;&#x8F93;&#x5165;&#xFF1A;<a href="http://localhost:9870/" target="_blank">http://localhost:9870/</a>   &#x6216;&#x8005;&#x5728;windows&#x673A;&#x5668;&#x4E0A;&#x8F93;&#x5165;<a href="http://&#x865A;&#x62DF;&#x673A;ip&#x5730;&#x5740;:9870/" target="_blank">http://&#x865A;&#x62DF;&#x673A;ip&#x5730;&#x5740;:9870/</a>  &#x4E5F;&#x53EF;&#x4EE5;&#x8BBF;&#x95EE; hadoop&#x7684;&#x7BA1;&#x7406;&#x9875;&#x9762;</p>
<p><img src="https://upload-images.jianshu.io/upload_images/7013389-a79fc86b86825305.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="image.png"></p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="1.1.html" class="navigation navigation-prev " aria-label="Previous page: 1.1 安装JDK">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="1.3.html" class="navigation navigation-next " aria-label="Next page: 1.3 完全分布式环境搭建">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"1.2 Hadoop伪分布式安装","level":"1.2.2","depth":2,"next":{"title":"1.3 完全分布式环境搭建","level":"1.2.3","depth":2,"path":"chapter1/1.3.md","ref":"chapter1/1.3.md","articles":[]},"previous":{"title":"1.1 安装JDK","level":"1.2.1","depth":2,"path":"chapter1/1.1.md","ref":"chapter1/1.1.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":[],"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"chapter1/1.2.md","mtime":"2019-05-06T12:24:23.060Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-05-06T16:09:52.649Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

